package com.youboy.wechatapi.service.record.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.youboy.wechatapi.domain.mysql.VisitInfo;
import com.youboy.wechatapi.repository.message.VisitRepository;
import com.youboy.wechatapi.service.record.VisitService;
import com.youboy.wechatapi.utils.wechat.YouboyApi;

/**
 * @ProjectName：wechatapi   
 * @author：冉尧（Yvan）
 * @CreateTime：2014年10月28日 上午11:03:41  
 * @Remarks：   
 */
@Service
public class VisitServiceImpl implements VisitService {

	@Autowired
	private VisitRepository visitRepository;
	
	@Override
	public void saveVisitInfo(String openid, String redirectUrl) throws Exception {
		Integer type = YouboyApi.getVisitType(redirectUrl);
		VisitInfo visit = new VisitInfo(openid, redirectUrl, type);
		visitRepository.save(visit);
	}

}

